---
title: 'Misinformation Spreading'
description: 'Comprehensive guide to all available actions in the OASIS simulation environment'
---

# Misinformation Spreading

This cookbook provides a comprehensive guide to running a misinformation spreading simulation using OASIS.

First, we need to download the user profile data.
[Download the user profile data](https://drive.google.com/drive/folders/1hs5D8vBj_eMkxR4N7Y-qRnTjTTh3ENFY?usp=sharing)

```python
import asyncio
import os
import random

from camel.models import ModelFactory
from camel.types import ModelPlatformType, ModelType

import oasis
from oasis import ActionType, EnvAction, SingleAction


async def main():
    openai_model = ModelFactory.create(
        model_platform=ModelPlatformType.OPENAI,
        model_type=ModelType.GPT_4O_MINI,
    )

    # Define the available actions for the agents
    available_actions = [
        ActionType.CREATE_POST,
        ActionType.LIKE_POST,
        ActionType.REPOST,
        ActionType.FOLLOW,
        ActionType.DO_NOTHING,
        ActionType.QUOTE_POST,
    ]

    # Define the path to the database
    db_path = "./data/twitter_simulation.db"

    # Delete the old database
    if os.path.exists(db_path):
        os.remove(db_path)

    # Make the environment
    env = oasis.make(
        platform=oasis.DefaultPlatformType.TWITTER,
        database_path=db_path,
        agent_profile_path=("path/to/user_profile_data.csv"),
        agent_models=openai_model,
        available_actions=available_actions,
    )

    # Run the environment
    await env.reset()

    # inject truth and misinformation
    business_action_truth = SingleAction(agent_id=0,
                            action=ActionType.CREATE_POST,
                            args={"content": "Amazon is expanding its delivery drone program to deliver packages within 30 minutes in select cities. This initiative aims to improve efficiency and reduce delivery times."})
    business_action_misinfo = SingleAction(agent_id=0,
                            action=ActionType.CREATE_POST,
                            args={"content": "Amazon plans to completely eliminate its delivery drivers within two years due to the new drone program. #Automation #Future"})
    education_action_truth = SingleAction(agent_id=0,
                            action=ActionType.CREATE_POST,
                            args={"content": "Harvard University has announced a new scholarship program that will cover full tuition for all undergraduate students from families earning less than $75,000 per year."})
    education_action_misinfo = SingleAction(agent_id=0,
                            action=ActionType.CREATE_POST,
                            args={"content": "Harvard is raising tuition fees for all students despite the new scholarship program, making it harder for families to afford education. #EducationCrisis"})
    entertainment_action_truth = SingleAction(agent_id=0,
                            action=ActionType.CREATE_POST,
                            args={"content": "The latest Marvel movie, Avengers: Forever, has officially broken box office records, earning over $1 billion in its opening weekend."})
    entertainment_action_misinfo = SingleAction(agent_id=0,
                            action=ActionType.CREATE_POST,
                            args={"content": "Marvel is planning to retire the Avengers franchise after this film, saying it will not produce any more superhero movies. #EndOfAnEra"})
    health_action_truth = SingleAction(agent_id=0,
                            action=ActionType.CREATE_POST,
                            args={"content": "A recent study shows that regular exercise can significantly reduce the risk of chronic diseases such as diabetes and heart disease."})
    health_action_misinfo = SingleAction(agent_id=0,
                            action=ActionType.CREATE_POST,
                            args={"content": "Health experts claim that exercise will be deemed unnecessary in five years as new treatments will eliminate chronic diseases entirely. #HealthRevolution"})


    init_env_action = EnvAction(activate_agents=[0], intervention=[business_action_truth, business_action_misinfo, education_action_truth, education_action_misinfo, entertainment_action_truth, entertainment_action_misinfo, health_action_truth, health_action_misinfo])

    env_simulation_actions = [init_env_action]
    for timestep in range(3):
        # Randomly select 1% of agents to activate. This is the active probability in the paper.
        total_agents = env.get_num_agents()
        num_agents_to_activate = max(1, int(total_agents * 0.01))  # Ensure at least 1 agent is activated
        agents_to_activate = random.sample(range(total_agents), num_agents_to_activate)

        # Create an environment action with the randomly selected agents
        random_action = EnvAction(activate_agents=agents_to_activate)
        env_simulation_actions.append(random_action)

    # Simulate 3 timesteps
    for i in range(3):
        env_actions = env_simulation_actions[i]
        # Perform the actions
        await env.step(env_actions)

    # Close the environment
    await env.close()


if __name__ == "__main__":
    asyncio.run(main())

```
